package hck;

import static org.junit.Assert.assertTrue;
import robocode.BattleResults;
import robocode.control.events.BattleCompletedEvent;
import robocode.control.testing.RobotTestBed;

/**
 * Tests that StoogeBot has rammed the enemy.
 * 
 * @author Harry Kwan
 * 
 */
public class TestStoogeBotRamEnemy extends RobotTestBed {
  /** True if the robot visited this corner during the test case. */
  boolean rammedEnemy = false;

  /**
   * Specifies that Target and StoogeBot are to be matched up in this test case.
   * 
   * @return The comma-delimited list of robots in this match.
   */
  @Override
  public String getRobotNames() {
    return "sample.Target,hck.StoogeBot";
  }

  /**
   * After the battle, check to see that ram damage has occured.
   * 
   * @param event Details about the completed battle.
   */
  @Override
  public void onBattleCompleted(BattleCompletedEvent event) {
    BattleResults[] battleResults = event.getIndexedResults();
    BattleResults StoogeBotResults = battleResults[1];

    if (StoogeBotResults.getRamDamage() > 0) {
      rammedEnemy = true;
    }

    // Check that StoogeBot rammed the enemy.
    assertTrue("Check Rammed Enemy", rammedEnemy);
  }
}
